//
//  BaseTabBarController.m
//  PandaTakeaway
//
//  Created by smufs on 2017/5/17.
//  Copyright © 2017年 李冰. All rights reserved.
//

#import "BaseTabBarController.h"
#import "BaseNavigationController.h"
#import "HomeViewController.h"
//#import "OrderViewController.h"
#import "MineViewController.h"
#import "LoginViewController.h"
#import "MineMsgViewController.h"

@interface BaseTabBarController ()<UITabBarControllerDelegate>

@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    HomeViewController *home = [[HomeViewController alloc] init];
    home.title = @"首页";
    home.tabBarItem.image = [[UIImage imageNamed:@"ic_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    home.tabBarItem.selectedImage = [[UIImage imageNamed:@"ic_home_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    BaseNavigationController *homeNavi = [[BaseNavigationController alloc] initWithRootViewController:home];
    
    MineMsgViewController *order = [[MineMsgViewController alloc] init];
    order.isTab = YES;
    order.title = @"消息";
    order.tabBarItem.image = [[UIImage imageNamed:@"ic_mail"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    order.tabBarItem.selectedImage = [[UIImage imageNamed:@"ic_mail_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    BaseNavigationController *orderNavi = [[BaseNavigationController alloc] initWithRootViewController:order];
    
    MineViewController *mine = [[MineViewController alloc] init];
    mine.title = @"我的";
    mine.tabBarItem.image = [[UIImage imageNamed:@"ic_mine"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    mine.tabBarItem.selectedImage = [[UIImage imageNamed:@"ic_mine_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    BaseNavigationController *mineNavi = [[BaseNavigationController alloc] initWithRootViewController:mine];
    
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithHex:0xb2b2b2],NSForegroundColorAttributeName,nil]forState:UIControlStateNormal];
    
    [[UITabBarItem appearance]setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithHex:0x13b5ea],NSForegroundColorAttributeName,nil]forState:UIControlStateSelected];
    self.tabBar.translucent = NO;
    self.tabBar.backgroundColor = TabBarTintColor;
    [self setViewControllers:@[homeNavi, orderNavi, mineNavi]];
}

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
    
    return YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
